<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../template/AdminTemplate.xhtml">

    <ui:define name="contentInsert">
        
        <h3>Change Stakeholder Tier</h3>
        <h:form>
                    <h:panelGrid columns="3">
                        <h:outputLabel for="stakeholderName" value="Stakeholder name:"/>
                        <p:inputText 
                            id="stakeholderName" value="#{stakeholderAccountsManagerBean.stakeholderName}"/>
                        <p:message for="stakeholderName"/>

 
                    </h:panelGrid>
                    <p:commandButton id="submitNewStakeholder" value="Search" ajax="false" update="display"
                                     action="changeStakeholderTierAfter.xhtml"  />
                    <br/>
                    <br/>
                    <p:dataTable value="#{stakeholderAccountsManagerBean.getAllStakeholders()}" var="o" paginator="true" rows="10"
                                 styleClass="order-table"

                                 >
                  
                        <p:column>

                            <f:facet name="header">Stakeholder Name</f:facet>
                            #{o.getName()}

                        </p:column>

                        <p:column>

                            <f:facet name="header">Loyalty points</f:facet>
                            #{o.loyaltyPoints}

                        </p:column>

                        <p:column>

                            <f:facet name="header">Stakeholder Tier</f:facet>
                            #{o.getStakeholderTier().getName()}

                        </p:column>

                    </p:dataTable>
                    <p:panel id="panel" >
                        <p:ajaxStatus style="width:16px;height:16px;">
                            <f:facet name="start">
                                <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value="" />
                            </f:facet>
                        </p:ajaxStatus>
                        <p:messages />   
                    </p:panel>

                </h:form>
                <br/>
                <h:form>
                    
                    
                        <h:outputText value="Stakeholder Name: "  /> <t/>
                        <h:selectOneMenu value="#{stakeholderAccountsManagerBean.stakeholderName}"> 
                            <f:selectItems value="#{stakeholderAccountsManagerBean.getNamesOfAllStakeholders()}"/>

                        </h:selectOneMenu>
                        <br/>
                        <br/>
                        <h:outputText value="Stakeholder Tier: "  /> <t/>

                        <h:selectOneMenu value="#{stakeholderAccountsManagerBean.stakeholderTier}">

                            <f:selectItems value="#{stakeholderAccountsManagerBean.getNamesOfAllTiers()}"/>
                        </h:selectOneMenu>
                        <br/>
                        <br/>
                        <h:commandButton value="Change Stakeholder Tier" 
                         onclick="if (!confirm('Are you sure you want to change stakeholder tier?')) return false"
                                    action="#{stakeholderAccountsManagerBean.changeStakeholderTier()}"
                                    />
                    
                </h:form>
        

    </ui:define>
</ui:composition>


